//
//  OwnerInfoCalloutView_iPad.m
//  PhongThuyHuongNha
//
//  Created by Le Anh Tai on 10/19/13.
//  Copyright (c) 2013 Le Anh Tai. All rights reserved.
//

#import "OwnerInfoCalloutView_iPad.h"
#import "Utility.h"
#import "UIConstants.h"

#define XEM_BUTTON_TITLE @"Xem"

@implementation OwnerInfoCalloutView_iPad

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    
    if (self)
    {
        //xem button
        _xemButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_xemButton addTarget:self action:@selector(xemButtonPressed) forControlEvents:UIControlEventTouchUpInside];
        [_xemButton setTitle:XEM_BUTTON_TITLE forState:UIControlStateNormal];
        [_xemButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_xemButton setBackgroundImage:[Utility setBackgroundImageByColor:COLOR_BLACK withFrame:RECT(0, 0, 2, 2)] forState:UIControlStateNormal];
        [_xemButton setBackgroundImage:[Utility setBackgroundImageByColor:COLOR_LIGHT_BLACK withFrame:RECT(0, 0, 2, 2)] forState:UIControlStateHighlighted];
        [_subView addSubview:_xemButton];
    }
    
    return self;
}

- (void)setFrame:(CGRect)frame
{
    [super setFrame:frame];
    
    _xemButton.frame = RECT(0, _genderLabel.bottom, _subView.width, OWNER_INFO_HEIGHT_BUTTON);
}

- (void)xemButtonPressed
{
    if ([self.delegate respondsToSelector:@selector(OwnerInfoCalloutViewDidPressedXemButton:)])
    {
        [self.delegate OwnerInfoCalloutViewDidPressedXemButton:self];
    }
    
    [self close];
}
@end
